package com.jianxiu.utils;

import org.apache.commons.lang3.StringUtils;

public class CodeUtils {

    public static String getImgSuffix(String base64Str) {
        String head = StringUtils.substringBefore(base64Str, ";");
        String type = StringUtils.substringAfter(head, "/");
        if (StringUtils.equals("gif", type)) return "gif";
        if (StringUtils.equals("png", type)) return "png";
        if (StringUtils.equals("jpeg", type)) return "jpg";
        if (StringUtils.equals("x-icon", type)) return "icon";
        if (StringUtils.equals("jpg", type)) return "jpg";
        return "jpg";
    }
}
